lib/checkout: Fix regression in subpath for regular files
authorColin Walters <walters@verbum.org>
Fri, 12 May 2017 00:29:21 +0000 (20:29 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 12 May 2017 14:00:20 +0000 (14:00 +0000)
commita195888b0f74ae3739a1a18fc46d39ae4686c5aa
treedb760b2ac5af3b194cd0c75d3a3d706133e60b5b
parentb83d509e78ff37edf384a9417d0d70af5982a31c
lib/checkout: Fix regression in subpath for regular files

This is what caused the merge of
https://github.com/projectatomic/rpm-ostree/pull/652
to blow up, since https://github.com/ostreedev/ostree/pull/848
landed right before we tried to merge it.

When I was writing that PR I remember having an uncertain feeling
since we were doing a `mkdirat` above, but at the time I thought
we'd have test suite coverage...turns out we didn't.

For backwards compatibility, we need to continue to do a `mkdirat` here of the
parent. However...I can't think of a reason anyone would *want* that behavior.
Hence, let's add a special trick - if the destination name is `.`, we skip
`mkdirat()`. That way rpm-ostree for example can open a dfd for `/etc` and avoid
the `mkdir`.

Fold the subpath tests into `test-basic.sh` since it's not worth a separate
file. Add a test case for checking out a file.

Closes: #854
Approved by: jlebon
Makefile-tests.am
src/libostree/ostree-repo-checkout.c
tests/basic-test.sh
tests/test-repo-checkout-subpath.sh [deleted file]